


$(function(){
// console.log();
 var id=window.location.hash.substr(1);//id
// console.log(id);


console.log(id);
// console.log(datea.branding);
var scc=indexjson[id].scid;
var datea=indexjson[id]





	
	var Commodityurl=datea.goodsList[0].Commodityurl;//商品展示大图
	var gname=datea.goodsList[0].gname;//商品描述
	var price=datea.goodsList[0].newprice;//商城价格
	var scprice=datea.goodsList[0].marketprice;//市场价格
	var vipprice=datea.goodsList[0].vipprice;//vip价格
	var pj=datea.goodsList[0].evaluation;//评价
	var xiaoliang=datea.goodsList[0].solds;//销量
	var kucun=datea.goodsList[0].inventory;//库存
	var pinpai=datea.brand;//品牌
	var man1=datea.goodsList[0].coupons[0].full;//满
	var jian1=datea.goodsList[0].coupons[0].reduction;//减
	var man2=datea.goodsList[0].coupons[1].full;//满
	var jian2=datea.goodsList[0].coupons[1].reduction;//减
	var minitus=datea.minimg;
	
	//主图
		var xqy=$(`<img src="${Commodityurl}" id="bqhtpimg" alt="">
						<div class="min-mask"></div>`)
						
		$(".max-top-t").append(xqy)
	
//渲染小图
var mins=$(`<img  class="xiaotu" src="${minitus[0]}" alt="">
		<img  class="xiaotu" src="${minitus[1]}" alt="">
		<img  class="xiaotu" src="${minitus[2]}" alt="">`);


$(".mtc-img").append(mins)

//渲染蒙版
var msk=$(`<img src="${Commodityurl}" alt="" class="max-tu">`);


$(".max-mask").append(msk);

// 渲染详情页

var xiangqingye=$(`	<div class="max-r-top">${gname}</div>
					<div class="max-r-c">
						<div class="scj">商城价</div>
						<div class="jjtz">
							<p><span class="jjtz-price"><span></span>${price}</span></p>
							<p>累计评价 <span class="ljpj">${pj} </span><span class="fgx">|</span>累计销量
								<span class="ljxl">${xiaoliang}</span>
							</p>
						</div>
					</div>
					<div class="gjVip">
						<div class="gjVip-max">
							<div class="gjVip-tu"><i class="bi bi-alexa"></i></div>
							<p>高级VIP可享超值优惠价<span class="vip-price">${vipprice}</span>
								<span class="ljkt">立即开通&gt;&gt;</span>
							</p>
						</div>
						<div class="sjgm">手机购买 <i class="bi bi-calendar2-minus"></i></div>
					</div>
					<div class="scj-no">市 场 价<span class="scj-price">${scprice}</span></div>
					<div class="lingj">
						<p>领 劵</p>
						<div class="msjy">
							<p>满<span>${man1}</span>减<span class="lj-min">${jian1}</span></p>
							<p>满<span>${man2}</span>减<span class="lj-min">${jian2}</span></p>
						</div>
					</div>
					<div class="ps-max">
						<div class="ps-max-son">
							<span class="ps">配送</span>
							<form>
							        <div style="position: relative;">
							            <!-- container -->
							           <input readonly type="text" data-toggle="city-picker" placeholder="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请选择省&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;市&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;区县&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;镇">
							        </div>
							    </form>
						</div>
						<p class="pp">品牌<span class="pp-sj">${pinpai}</span></p>
						<div class="num">数量<input type="number" value="1" class="num-text">
						
							<p>库存<span class="kq-num">${kucun}</span>个</p>
						</div>
						<p class="wxts">温馨提示 <span class="zcqt">支持7天无理由退货1</span> </p>
						<div class="ljgm-max">
							<div class="ljgm">立即购买</div>
							<div class="jrgwc"><i class="bi bi-cart2"></i> 加入购物车</div>

						</div>
					</div>
`)

$(".max-nav-right").append(xiangqingye)
// var gwucid=[];
$(".jrgwc").click(function(){
	if (window.confirm("是否加入购物车?")) {
		localStorage.setItem("id"+id,id)
	}
	
	
})

$("#SCSCSD").click(function(){
	
	if (window.confirm("是否加入收藏?")) {
		localStorage.setItem("shou"+id,id)
	}
	
	
	
	
	
})


$(".xiaotu").on("mouseover",function(){
	
	var djsrc=$(this).prop("src");
	console.log(djsrc);
	$(this).parents(".max-top-c").prev().find("#bqhtpimg").prop("src",djsrc);
	$(this).parents(".max-top-c").nextAll(".max-mask").find(".max-tu").prop("src",djsrc);
})


})
  